#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#

"""
一、元素分类
有如下值集合 [11,22,33,44,55,66,77,88,99,90...]，将所有大于 66 的值保存至字典的第一个key中，
将小于 66 的值保存至第二个key的值中。
即： {'k1': 大于66的所有值, 'k2': 小于66的所有值}
"""

li = [11, 22, 33, 44, 55, 66, 77, 88, 99, 90]
new_k = {"k1": None, "k2": None}
new_k["k1"] = [i for i in li if i >= 66]
new_k["k2"] = [i for i in li if i <= 65]
print(new_k)   # {'k1': [66, 77, 88, 99, 90], 'k2': [11, 22, 33, 44, 55]}

x1, x2 = [], []
for i in li:
    x1.append(i) if i >= 66 else x2.append(i)

new_k["k1"] = x1
new_k["k2"] = x2
print(new_k)   # {'k1': [66, 77, 88, 99, 90], 'k2': [11, 22, 33, 44, 55]}

new_k = {"k1": [i for i in li if i >= 66], "k2": [i for i in li if i <= 65]}
print(new_k)   # {'k1': [66, 77, 88, 99, 90], 'k2': [11, 22, 33, 44, 55]}
